<%
var headContent = {
include("/pages/template/head.html"){}
%>

<script type="text/javascript">
    var oper;
    jQuery(function($) {
        // 页面方法
        oper = {
            width : 450,
            height : 500,
            form : document.form1,
            list : function() {
                var url = 'system/agentProsDiscount/list';
                this.form.action = url;
                this.form.submit();
            },
            
            view : function(id,productIds,vasProdName) {
              var url = 'system/agentProsDiscount/view/'+id+'?productIds='+productIds;
                var title = '<span style = "font-size:20px;" class ="font-danger">&lt'+vasProdName+'&gt折扣记录</span>';
                Iframe(url, 800, this.height, title);
            },
            add : function() {
                var url = 'system/agentProsDiscount/add';
                var title = '添加折扣';
                Iframe(url, 600, 800, title);
            },
            edit : function(id) {
                var url = 'system/agentProsDiscount/edit/'+id;
                var title = '修改折扣';
                Iframe(url, this.width, this.height, title);
            },
            del : function(id) {
                var url = 'system/agentProsDiscount/delete/'+id;
                var title = '确认要删除该折扣信息？';
                Confirm(title, function() {
                    form1.action = url;
                    form1.submit();
                });
            }
        };
        //显示Menu索引
        showMenu('page_system');
        showMenu('page_productinfo');
    });

    //分页
    var paginator = function(page) {
        oper.list();
    };

</script>

<%
};

var bodyContent = {
%>
<form name="form1" action="" method="post"  class="form-inline" role="form">
	<!-- 菜单 -->
	<% include("/pages/template/menu.html"){} %>

	<div class="tableSearch">
		<%  //查询列表 %>
			<div class="form-group">
				<select name="attr.customerId" class="form-control" style="width:196px;">
				<option value="">请选择客户</option>
				${selectCustomer }
				</select>
		</div>
		<div class="form-group">
			<input class="form-control" type="text" name="attr.proId" value="${attr.proId!''}"
				   placeholder="请输入平台产品名称" required='required' />
		</div>


		
		<button type="button" class="btn btn-default" onclick="resetForm();">
			<span class="glyphicon glyphicon-refresh"></span> 重 置
		</button>
		<button type="button" class="btn btn-default" onclick="oper.add();">
			<span class="glyphicon glyphicon-plus"></span> 新 增
		</button>
		<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			<span class="glyphicon glyphicon-search"></span> 查 询
		</button>
	</div>

	<!-- 数据列表 -->
	<table class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th>序号</th>
			<%  // 列表头部 %>
			<th style="display:none" name="ids" class="sorting">ids</th>
			<th name="b.customerName" class="sorting">客户名称</th>
			<th name="c.vasProdName" class="sorting">平台产品名称</th>
			<th name="a.discount" class="sorting">折扣</th>
			<th name="a.begin_time" class="sorting">折扣开始时间</th>
			<th name="a.end_time" class="sorting">折扣结束时间</th>
			<th name="a.create_time" class="sorting">创建时间</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		<% for(item in page.list){ %>
		<tr>
			<td>${itemLP.index }</td>
			<%  // 列表内容 %>
			<td>${item.customerName}</td>
			<td>${item.vasProdName}</td>
			<td>${item.discount}</td>
			<td>${item.begin_time}</td>
			<td>${item.end_time}</td>
			<td>${item.create_time}</td>
			<td>
				<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view('${item.customerId}','${item.proId}','${item.vasProdName}');">折扣历史记录</a>
				<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit('${item.ids}');">修改</a>
				<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del('${item.ids}');">删除</a>
			</td>
		</tr>
		<% } %>
		</tbody>
	</table>
	<%include("/pages/includes/paginator.html"){} %>
</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>